package com.jy.event.domain;

import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;

/**
 * 盘点记录
 * Created by hanxi on 2017/8/1.
 */
@Entity
@Data
@NoArgsConstructor
public class StockCheckTransaction {
    @Id
    @Column(length = 50)
    private String id;
    private String productId;
    private String productName;
    private String storeId;
    /**
     * 误差数量
     */
    private int errorQuantity;
    /**
     * 盘点数量
     */
    private int checkQuantity;
    /**
     * 应有数量
     */
    private int accurateQuantity;
    /**
     * 操作人
     */
    private String operator;
    /**
     * 操作时间
     */
    @Column(columnDefinition = "TIMESTAMP(3) NULL")
    private Date operTime;
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3)")
    private Date addTime;

    public StockCheckTransaction(String id, String productId, String productName, int errorQuantity,
                                 int checkQuantity, int accurateQuantity, String operator, String storeId) {
        this.id = id;
        this.productId = productId;
        this.productName = productName;
        this.errorQuantity = errorQuantity;
        this.checkQuantity = checkQuantity;
        this.accurateQuantity = accurateQuantity;
        this.operator = operator;
        this.operTime = new Date();
        this.storeId = storeId;
    }
}
